package org.aclyyx.malata.app.e3;

import java.io.File;
import java.io.FileInputStream;

import org.aclyyx.malata.app.Security;
import org.aclyyx.malata.app.StaticData;
import org.aclyyx.malata.app.e2.ReadAllList;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

public class MainProc {
	

	public static void main(String[] args) {
		Security s = new Security();
		if (!s.check()) {
			return;
		}

		Action action = new Action();
		try {
			File file = new File(StaticData.E3_S1);
			String[] fs = file.list();
			for (int y = 0; y < fs.length; y++) {
		        POIFSFileSystem pfs = new POIFSFileSystem(new FileInputStream(StaticData.E3_S1 + StaticData.SP + fs[y]));
		        HSSFWorkbook wb = new HSSFWorkbook(pfs);
		        action.initMap(wb);
			}

			file = new File(StaticData.E3_S2);
			fs = file.list();
			for (int y = 0; y < fs.length; y++) {
		        POIFSFileSystem pfs = new POIFSFileSystem(new FileInputStream(StaticData.E3_S2 + StaticData.SP + fs[y]));
		        HSSFWorkbook wb = new HSSFWorkbook(pfs);
		        action.compare(wb);
			}

			action.checkAll();
			
			action.printTarget();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
